<?php 
$title = "Chi tiết tin tức thị trường tài chính mới nhất - Tài Chính Online";
$description = "Chuyên trang tổng hợp các tin tức và giải pháp về thị trường tài chính, bất động sản, chứng khoán, kinh tế và ngân hàng mới nhất hiện nay - Tài Chính Online";
$keywords = "đọc tin tức, tin ngân hàng, tin nổi bật, tài chính, thông tin mới cập nhật, tài chính online";
?>
<?php
require_once ("src/db/connectdatabase.php");

function getNew($id) {
	$con = new ConnectDB();
	$tbl = "news";
	$fn = array('new_title', 'datecreate', 'new_content', 'idtnew');
	$condetion = array('new_id' => $id);
	return $con -> getvalue($tbl, $fn, $condetion);
}

function getNews($idtype, $idcurrent) {
	$con = new ConnectDB();
	
	$sql = "SELECT new_id, new_title, datecreate FROM news WHERE idtnew LIKE '%".$idtype."%' AND new_id <>'".$idcurrent."' ORDER BY datecreate DESC LIMIT 0,5";
	return $con -> getvalueString($sql);
}

function int_to_date($int)
{
    $time  = date("d/m/Y", $int);
    return $time;
}

if(isset($_GET['id'])) {
	$id = $_GET['id'];
	$arrnew = getNew($id);
	if(count($arrnew) > 0) {
?>
<div class="intrl_txt" style="margin: auto;">
    <div style="float: left; clear: right;">
        <div class="text12" style="margin:auto; width:970px; height:11px; color:#0a8bd9;"><u><a href="http://taichinhonline.vn" class="text12" style="color: #0080d6;">Trang Chủ</a></u>&gt; <u><a href="<?php echo($host) ?>tin-tuc-truyen-thong.html" class="text12" style="color: #0080d6;">Tin tức tài chính</a></u>&gt; Chi tiết tin tức</span></div>
        <div style="width:663px; max-width:663px; height: auto; margin-top:0px; float:left; clear:right;">
            <div style="height: auto; margin-top:15px; float:left; clear:right;">
                <h1 class="text3" style="margin-top:0px; clear:right; font-size:16px; text-transform:none; color:#88a943;"><strong><?php echo($arrnew[0][0]) ?></strong></h1><span style="font-size:12px;"><i>Ngày cập nhật: <?php echo(int_to_date($arrnew[0][1])) ?></i></span>
                <div style="clear:both; height:15px;"></div>
                <div id="txt" style="width:663px;"><?php echo($arrnew[0][2]) ?></div>
                <br /><br />
            </div>
            <div class="clear"></div>
            <div style="margin-bottom: 30px;">
            	<h1 style="font-size: 15px; text-transform:uppercase;">TIN MỚI NHẤT</h1>
                <?php 
				$arrnewnew = getNews('', $id);
				foreach($arrnewnew as $entry) {
					$strbanknameurl2 = $entry[1];
					$strbanknameurl2 = rewriteTextUrl(stripUnicode($strbanknameurl2));
				?>
                <p><strong><a class="link-click-xemthem-class" href="<?php echo($host) ?>tin-tuc/detail/<?php echo($entry[0]) ?>/<?php echo($strbanknameurl2) ?>.html"><?php echo($entry[1]) ?></a></strong><em>(<?php echo(int_to_date($entry[2]))?>)</em></p>
                <?php } ?>
            </div>
            <div class="clear"></div>
            <div>
            	<h1 style="font-size: 15px; text-transform:uppercase;">TIN KHÁC CÙNG CHUYÊN MỤC</h1>
                <?php 
				$arrnewcungchuyenmuc = getNews($arrnew[0][3], $id);
				foreach($arrnewcungchuyenmuc as $entry) {
					$strbanknameurl2 = $entry[1];
					$strbanknameurl2 = rewriteTextUrl(stripUnicode($strbanknameurl2));
				?>
                <p><strong><a class="link-click-xemthem-class" href="<?php echo($host) ?>tin-tuc/detail/<?php echo($entry[0]) ?>/<?php echo($strbanknameurl2) ?>.html"><?php echo($entry[1]) ?></a></strong><em>(<?php echo(int_to_date($entry[2]))?>)</em></p>
                <?php } ?>
                
                <div><strong><a style="color: #666;" class="link-click-xemthem" href="<?php echo($host) ?>tin-tuc/<?php echo($arrnew[0][3]) ?>/tin-tuc.html">>> Xem tất cả</a></strong></div>
            </div>
        </div>
        
        <div style="float: right; clear: right; background-image: url(<?php echo($host) ?>images/gray_bg.gif); width: 275px; height: auto; margin-top: 10px;">
            <?php include("formsendapplybaogia.php"); ?>
            <iframe src="//www.facebook.com/plugins/likebox.php?href=https%3A%2F%2Fwww.facebook.com%2Ftaichinhonline.vn&amp;width=275&amp;height=258&amp;colorscheme=light&amp;show_faces=true&amp;header=false&amp;stream=false&amp;show_border=false" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:275px; height:275px;" allowTransparency="true"></iframe><iframe frameborder="0" marginwidth="0" marginheight="0" src="http://www.thienduongweb.com/tool/weather/?size=280&fsize=12&bg=images/bg.png&repeat=repeat-x&r=1&w=1&g=1&d=0" width="275" height="240" scrolling="no"></iframe><a href="http://vaytinchap365.com"><img src="http://taichinhonline.vn/Logo vaytinchap365500x400_2.png" width="275" height="250" alt="vay tín chấp 365" longdesc="http://vaytinchap365.com" /> <a/><a href="http://vaytinchapnhanh365.com"><img src="http://taichinhonline.vn/vaytinchap365.jpg" width="275" height="250" alt="vay tín chấp 365" longdesc="http://vaytinchapnhanh365.com" /> <a/>
        </div>
        <div class="clear"></div>
	</div>
</div>
<style>
.link-click-xemthem:hover {
	color: #06F;
	text-decoration:none;
}
</style>
<?php
	}
}
?>